import Vue from "vue";
import App from "./App";

import store from "./store";
import ViewUI from "view-design";
import config from "@/config";
import router from "./router";
import uiTool from "@/libs/uiTool";
import { component } from "./component";

import "@babel/polyfill";

import "view-design/dist/styles/iview.css";
import "@/assets/icons/iconfont.css";
import "@/assets/css/animate.css";
import "@/assets/css/base.less";
import "@/assets/css/ivewExpand.less";

Vue.use(ViewUI);

/**
 * @description 生产环境关掉提示
 */
Vue.config.productionTip = false;
/**
 * @description 全局注册应用配置
 */
Vue.prototype.$config = config;

component.register();

let mainRoutes = uiTool.getRoutes();

router.addRoutes([mainRoutes]);

window.rootVue = new Vue({
  el: "#app",
  router,
  store,
  render: h => h(App),
  mounted() {
    uiTool.setRem();
    this.$store.dispatch("setAuthorityMenus");
  }
});

window.addEventListener("load", uiTool.setRem);
window.addEventListener("resize", uiTool.setRem);
